<!DOCTYPE html>
<!-- saved from url=(0022)https://www.baidu.com/ -->
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta content="always" name="referrer">
    <title>Blog Demo</title>
</head>

<body link="#0000cc">
<h3>
    {% if username %}
    Welcome {{username}}, <a href="/logout">退出</a>, <a href="/upload">上传文件</a>, <a href="/editblog">写博客</a>
    {% else %}
    <a href="/login">登录</a>, <a href="/register">注册</a>
    {% endif %}
</h3>

    <div id="wrapper" style="display: block;">
        <div id="head">
            <div class="head_wrapper">
                <div class="s_form">
                    <div class="s_form_wrapper soutu-env-mac soutu-env-index">
                        <div id="lg">
                            <img hidefocus="true" src="images/baidu_logo.png" width="270" height="129">
                        </div>
                        <form id="form" name="f" action="goto" class="fm">
                            <span class="bg s_ipt_wr quickdelete-wrap">
                            <span class="ipt_rec" style="display: block;"></span>
                            <span class="soutu-btn"></span>
                            <input id="kw" name="where" class="s_ipt" value="" maxlength="255" autocomplete="off">
                            </span>
                            <span class="bg s_btn_wr">
                                <input type="submit" id="su" value="百度一下" class="bg s_btn">
                            </span>
                        </form>
                        <button id="ajax_button" type="button">Ajax测试</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script type="text/javascript">
var btn = document.getElementById('ajax_button');
function loadXMLDoc() {
    var xmlhttp;
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200) {
            console.log('hello');
            p=document.createElement('p');
            btn.parentNode.insertBefore(p, btn);
            p.innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET", "/text/ajax.txt",true);
    xmlhttp.send();
}
btn.addEventListener('click', loadXMLDoc);
</script>
</body>
</html>
